package com.edu.fafu.studentrepair.command;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeChange {
    private static String dataFromat="yyyy-MM-dd";
    private static DateFormat format;
    public static String Long2Date(long dataLong){
        Date date = new Date(dataLong);
        format = new SimpleDateFormat(dataFromat);
        return format.format(date);
    }
    public static Long DateToLong(String data){
        try {
            format = new SimpleDateFormat(dataFromat);
            Date date = format.parse(data);
            return date.getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
